/*
 * SatelliteAERQueue.h
 *
 *  Created on: Dec 13, 2014
 *      Authors: Avihay Avitan & Stefan Farcas
 */

#ifndef SATELLITEAERQUEUE_H_
#define SATELLITEAERQUEUE_H_
#include "SatelliteAER.h"
#include <queue>

using namespace std;
namespace SatelliteNameSpace {

/**
 * SatelliteAERComperator is a class that implements the operator function that is responsible to decide which SatelliteAER should be before another
 * if there will be any other priority considerations that need to be take, they should be implemented here!
 */
class SatelliteAERComperator
{
public:
	bool operator()(SatelliteAER * s1 , SatelliteAER * s2)
	{
		if (s2->getTimeStamp() < s1->getTimeStamp() )
			return true;

		return false;
	}
};

/**
 * SatelliteAERQueue implement the model of the AER queue. each queue define the path that the satellite is going throw
 */
class SatelliteAERQueue {

public:
	SatelliteAERQueue();
	virtual ~SatelliteAERQueue();
	bool addInstance(SatelliteAER instance);
	SatelliteAER * popNextInstance();
	SatelliteAER * getTopInstance();
	SatelliteAER * getStartTrackingInstance();
	int getCountOfInstances();
	bool hasNextInstance();

private:
	priority_queue< SatelliteAER * , vector<SatelliteAER *>, SatelliteAERComperator >  pq;

};

} /* namespace SatelliteNameSpace */

#endif /* SATELLITEAERQUEUE_H_ */
